var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("sdkConfig"),
    a = (function () {
        function e() {
            (this.SW_SystemBanner = !1),
                (this.SW_SystemInters = !1),
                (this.SW_Video = !1),
                (this.SW_Native = !1),
                (this.SW_NativeBanner = !1),
                (this.SW_NativeInters = !1),
                (this.SW_Box = !1),
                (this.SW_Block = !1),
                (this.SW_BigNative = !1),
                (this.SW_IconNative = !1),
                (this.ID_SystemBanner = ""),
                (this.ID_SystemInters = ""),
                (this.ID_Native = ""),
                (this.ID_NativeCustom = ""),
                (this.ID_Video = ""),
                (this.ID_Box = ""),
                (this.ID_Block = ""),
                (this.NUM_NativeIntersP = 0),
                (this.NUM_NativeIntersReport = 1),
                (this.NUM_BannerErrP = 0),
                (this.NUM_BannerErrMost = 0),
                (this.NUM_BannerErrMust = 0),
                (this.NUM_VideoErrP = 0),
                (this.NUM_VideoErrMost = 0),
                (this.NUM_VideoErrMust = 0),
                (this.NUM_BannerUpdateTime = 30),
                (this.SW_SystemBannerFirst = !0),
                (this.NUM_BannerMostShow = 99),
                (this.SW_IntersBaseControl = !1),
                (this.NUM_IntersStart = 0),
                (this.NUM_IntersIntervalNum = 0),
                (this.NUM_IntersIntervalTime = 0),
                (this.NUM_IntersDelayTime = 0),
                (this.NUM_IntersDelayP = 0),
                (this.NUM_NativeUpdateTime = 30),
                (this.SW_AddDesktop = !1),
                (this.SW_IntersIntervalToAddDesktop = !1),
                (this.NUM_AutoAddDeskMostTimes = 0),
                (this.NUM_IntersToAddDesktopNumber = 0),
                (this.SW_Statistics = !0),
                (this.SW_NavigateIcon = !1),
                (this.SW_NavigateGroup = !1),
                (this.SW_NavigateSettle = !1),
                (this.pushGameList = []),
                (this.bannerAd = null),
                (this.loadSucc_SystemBanner = !1),
                (this.loadSucc_Banner = !1),
                (this.hasShowBanner = !1),
                (this.interval_updateBanner = null),
                (this.timeout_checkBannerLoadSucc = null),
                (this.NUM_CheckBannerLoadSucc = 0),
                (this.NUM_MaxCheckBannerLoadSucc = 5),
                (this.systemIntersAd = null),
                (this.loadSucc_SystemInters = !1),
                (this.NUM_hasShowInters = 0),
                (this.NUM_intersNowInterval = 0),
                (this.NUM_IntersNowIntervalTime = 99),
                (this.NUM_IntersNowToAddDesktop = 0),
                (this.videoAd = null),
                (this.loadSucc_Video = !1),
                (this.callback_Video = null),
                (this.boxAd = null),
                (this.loadSucc_Box = !1),
                (this.blockAd = null),
                (this.loadSucc_Block = !1),
                (this.NUM_CheckBlockLoadSucc = 0),
                (this.NUM_MaxCheckBlockLoadSucc = 5),
                (this.param_block = {blockSize: 5, blockType: "landscape", blockX: 32, blockY: 32}),
                (this.timeout_updateBlock = null);
        }
        return (
            (e.prototype.getGameTestVersion = function () {
                return !1;
            }),
            (e.prototype.createAd = function () {
                this.NUM_IntersIntervalTime > 0 && this.runIntersInterval(),
                    this.SW_SystemBanner && "" != this.ID_SystemBanner && this.createSystemBanner(),
                    this.SW_SystemInters && "" != this.ID_SystemInters && this.createSystemInters(),
                    this.SW_Video && "" != this.ID_Video && this.createVideo(),
                    this.SW_Box && "" != this.ID_Box && this.createBox(),
                    "" != this.ID_Block && this.createBlock();
            }),
            (e.prototype.startLoadPushGamaes = function () {}),
            (e.prototype.createSystemBanner = function () {
                var e = this;
                if (
                    (console.log("ChaoQiGameSDK", "--createSystemBanner--"),
                    n.default.stringHasSpace(this.ID_SystemBanner))
                )
                    console.log(
                        "ChaoQiGameSDK",
                        "channelId:",
                        n.default.channelId,
                        "当前渠道系统banner广告ID中含有空字符串,请检查后台系统banner广告ID*********************"
                    );
                else {
                    var t = Number(qq.getSystemInfoSync().windowWidth),
                        o = Number(qq.getSystemInfoSync().windowHeight);
                    (this.bannerAd = qq.createBannerAd({
                        adUnitId: this.ID_SystemBanner,
                        style: {left: 0, top: 0, width: o > t ? t : 400, height: 120},
                        testDemoType: "65"
                    })),
                        this.bannerAd.onResize(function (n) {
                            o > t || cc.winSize.height > cc.winSize.width
                                ? ((e.bannerAd.style.width = t), (e.bannerAd.style.height = t))
                                : ((e.bannerAd.style.width = t / 2), (e.bannerAd.style.height = t / 2)),
                                (e.bannerAd.style.top = o - n.height),
                                (e.bannerAd.style.left = (t - n.width) / 2);
                        }),
                        this.bannerAd.onLoad(function () {
                            console.log("ChaoQiGameSDK", "QQ banner加载成功"),
                                (e.loadSucc_SystemBanner = !0),
                                e.hasShowBanner && e.showSystemBanner();
                        }),
                        this.bannerAd.onError(function (e) {
                            console.log("ChaoQiGameSDK", "QQ banner加载失败：", JSON.stringify(e));
                        });
                }
            }),
            (e.prototype.createSystemInters = function () {
                var e = this;
                console.log("ChaoQiGameSDK", "--createSystemInters--"),
                    n.default.stringHasSpace(this.ID_SystemInters)
                        ? console.log(
                              "ChaoQiGameSDK",
                              "channelId:",
                              n.default.channelId,
                              "当前渠道系统插屏广告ID中含有空字符串,请检查后台系统插屏广告ID*********************"
                          )
                        : ((this.systemIntersAd = qq.createInterstitialAd({adUnitId: this.ID_SystemInters})),
                          this.systemIntersAd.onLoad(function () {
                              console.log("ChaoQiGameSDK", "QQ 系统插屏广告加载完成"), (e.loadSucc_SystemInters = !0);
                          }),
                          this.systemIntersAd.onError(function (t) {
                              console.log("ChaoQiGameSDK", "QQ 系统插屏广告加载失败：" + JSON.stringify(t)),
                                  (e.loadSucc_SystemInters = !1),
                                  setTimeout(function () {
                                      e.systemIntersAd && e.systemIntersAd.load();
                                  }, 3e4);
                          }),
                          this.systemIntersAd.onClose(function () {
                              e.NUM_IntersNowIntervalTime = 0;
                          }),
                          this.systemIntersAd.load());
            }),
            (e.prototype.createVideo = function () {
                var e = this;
                console.log("ChaoQiGameSDK", "--createVideo--"),
                    n.default.stringHasSpace(this.ID_Video)
                        ? console.log(
                              "ChaoQiGameSDK",
                              "channelId:",
                              n.default.channelId,
                              "当前渠道视频广告ID中含有空字符串,请检查后台视频广告ID*********************"
                          )
                        : ((this.videoAd = qq.createRewardedVideoAd({adUnitId: this.ID_Video})),
                          this.videoAd.onLoad(function () {
                              console.log("ChaoQiGameSDK", "QQ 视频广告加载完成"), (e.loadSucc_Video = !0);
                          }),
                          this.videoAd.onError(function (t) {
                              console.log("ChaoQiGameSDK", "QQ 视频加载失败：", JSON.stringify(t)),
                                  (e.loadSucc_Video = !1),
                                  setTimeout(function () {
                                      e.videoAd && e.videoAd.load();
                                  }, 3e4);
                          }),
                          this.videoAd.onClose(function (t) {
                              setTimeout(function () {
                                  t.isEnded
                                      ? (console.log("ChaoQiGameSDK", "QQ 激励视频广告完成，发放奖励"),
                                        e.callback_Video && (e.callback_Video(!0), e.videoAd.load()))
                                      : (console.log("ChaoQiGameSDK", "QQ 激励视频广告取消，不发放奖励"),
                                        e.callback_Video && (e.callback_Video(!1), e.videoAd.load()));
                              }, 500);
                          }),
                          this.videoAd.load());
            }),
            (e.prototype.createBox = function () {
                var e = this;
                console.log("ChaoQiGameSDK", "--createBox--"),
                    n.default.stringHasSpace(this.ID_Box)
                        ? console.log(
                              "ChaoQiGameSDK",
                              "channelId:",
                              n.default.channelId,
                              "当前渠道盒子广告ID中含有空字符串,请检查后台盒子广告ID*********************"
                          )
                        : ((this.boxAd = qq.createAppBox({adUnitId: this.ID_Box})),
                          this.boxAd.load().then(function () {
                              console.log("ChaoQiGameSDK", "QQ 加载盒子广告完成==================="),
                                  (e.loadSucc_Box = !0);
                          }),
                          this.boxAd.onClose(function () {
                              console.log("ChaoQiGameSDK", "QQ 关闭盒子广告"),
                                  e.boxAd.load().then(function () {
                                      console.log("ChaoQiGameSDK", "QQ 加载盒子广告完成==================="),
                                          (e.loadSucc_Box = !0);
                                  });
                          }));
            }),
            (e.prototype.createBlock = function () {
                var e = this;
                console.log("ChaoQiGameSDK", "--createBlock--"),
                    n.default.stringHasSpace(this.ID_Block)
                        ? console.log(
                              "ChaoQiGameSDK",
                              "channelId:",
                              n.default.channelId,
                              "当前渠道积木广告ID中含有空字符串,请检查后台积木广告ID*********************"
                          )
                        : (console.log("ChaoQiGameSDK", "this.param_block:", JSON.stringify(this.param_block)),
                          (this.blockAd = qq.createBlockAd({
                              adUnitId: this.ID_Block,
                              size: this.param_block.blockSize,
                              orientation: this.param_block.blockType,
                              style: {left: this.param_block.blockX, top: this.param_block.blockY}
                          })),
                          this.blockAd.onLoad(function () {
                              console.log("ChaoQiGameSDK", "QQ 积木广告加载成功"), (e.loadSucc_Block = !0);
                          }),
                          this.blockAd.onError(function (t) {
                              e.NUM_CheckBlockLoadSucc++,
                                  console.log(
                                      "ChaoQiGameSDK",
                                      e.NUM_CheckBlockLoadSucc,
                                      "QQ 积木广告加载失败：",
                                      JSON.stringify(t)
                                  ),
                                  e.NUM_CheckBlockLoadSucc >= e.NUM_MaxCheckBlockLoadSucc ||
                                      ((e.loadSucc_Block = !1),
                                      setTimeout(function () {
                                          e.createBlock();
                                      }, 2e4));
                          }));
            }),
            (e.prototype.showBanner = function () {
                this.loadSucc_Banner
                    ? this.hasShowBanner
                        ? console.log("ChaoQiGameSDK", "已经调用过showBanner,请勿重复调用")
                        : ((this.hasShowBanner = !0),
                          this.SW_SystemBanner && (this.showSystemBanner(), this.updateSystemBanner()))
                    : this.checkBannerLoadSucc();
            }),
            (e.prototype.hideBanner = function () {
                (this.hasShowBanner = !1),
                    this.hideSystemBanner(),
                    this.interval_updateBanner && clearInterval(this.interval_updateBanner),
                    this.timeout_checkBannerLoadSucc && clearTimeout(this.timeout_checkBannerLoadSucc);
            }),
            (e.prototype.getIntersFlag = function () {
                return this.loadSucc_SystemInters || (this.SW_AddDesktop && this.NUM_AutoAddDeskMostTimes > 0);
            }),
            (e.prototype.showInters = function () {
                var e = this;
                if (
                    (this.NUM_hasShowInters++,
                    this.SW_IntersIntervalToAddDesktop &&
                        this.NUM_hasShowInters <= this.NUM_IntersToAddDesktopNumber &&
                        (console.log(
                            "ChaoQiGameSDK",
                            "第" + this.NUM_IntersToAddDesktopNumber + "次插屏变添加桌面",
                            "当前第" + this.NUM_hasShowInters + "次"
                        ),
                        this.NUM_hasShowInters == this.NUM_IntersToAddDesktopNumber))
                )
                    this.getAddDesktopFlag(function (t) {
                        t && (console.log("ChaoQiGameSDK", "插屏变添加桌面"), e.addDesktop(function () {}));
                    });
                else {
                    if (this.SW_IntersBaseControl) {
                        if (this.NUM_hasShowInters < this.NUM_IntersStart)
                            return void console.log(
                                "ChaoQiGameSDK",
                                "插屏开始次数未达到",
                                this.NUM_hasShowInters,
                                "目标次数",
                                this.NUM_IntersStart
                            );
                        if (this.NUM_intersNowInterval < this.NUM_IntersIntervalNum)
                            return (
                                console.log(
                                    "ChaoQiGameSDK",
                                    "插屏间隔次数未达到",
                                    this.NUM_intersNowInterval,
                                    "目标次数",
                                    this.NUM_IntersIntervalNum
                                ),
                                void this.NUM_intersNowInterval++
                            );
                        if (this.NUM_IntersNowIntervalTime < this.NUM_IntersIntervalTime)
                            return (
                                console.log(
                                    "ChaoQiGameSDK",
                                    "插屏间隔时间未达到",
                                    this.NUM_IntersNowIntervalTime,
                                    "目标时间",
                                    this.NUM_IntersIntervalTime
                                ),
                                void (
                                    this.SW_AddDesktop &&
                                    this.NUM_IntersNowToAddDesktop < this.NUM_AutoAddDeskMostTimes &&
                                    this.getAddDesktopFlag(function (t) {
                                        t &&
                                            (e.NUM_IntersNowToAddDesktop++,
                                            e.addDesktop(function () {
                                                console.log("ChaoQiGameSDK", "插屏间隔弹桌面");
                                            }));
                                    })
                                )
                            );
                    }
                    (this.NUM_intersNowInterval = 0),
                        this.NUM_IntersDelayTime > 0 && Math.floor(100 * Math.random()) < this.NUM_IntersDelayP
                            ? (console.log("ChaoQiGameSDK", "插屏延迟时间(ms):" + this.NUM_IntersDelayTime),
                              setTimeout(function () {
                                  e.loadSucc_SystemInters && e.showSystemInters();
                              }, this.NUM_IntersDelayTime))
                            : this.loadSucc_SystemInters && this.showSystemInters();
                }
            }),
            (e.prototype.getVideoFlag = function () {
                return this.loadSucc_Video;
            }),
            (e.prototype.showVideo = function (e) {
                this.videoAd &&
                    this.loadSucc_Video &&
                    ((this.callback_Video = e),
                    console.log("ChaoQiGameSDK", "QQ showVideo========================"),
                    (this.loadSucc_Video = !1),
                    this.videoAd.show());
            }),
            (e.prototype.getNativeIconFlag = function () {
                return !1;
            }),
            (e.prototype.showNativeIcon = function () {}),
            (e.prototype.hideNativeIcon = function () {}),
            (e.prototype.getNativeImageFlag = function () {
                return !1;
            }),
            (e.prototype.showNativeImage = function () {}),
            (e.prototype.hideNativeImage = function () {}),
            (e.prototype.getNativeAdFlag = function () {
                return !1;
            }),
            (e.prototype.getNativeAdInfo = function () {
                return null;
            }),
            (e.prototype.reportNativeAdShow = function () {}),
            (e.prototype.reportNativeAdClick = function () {}),
            (e.prototype.getNavigateIconFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateIcon = function () {}),
            (e.prototype.hideNavigateIcon = function () {}),
            (e.prototype.getNavigateGroupFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateGroup = function () {}),
            (e.prototype.hideNavigateGroup = function () {}),
            (e.prototype.getNavigateSettleFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateSettle = function () {}),
            (e.prototype.hideNavigateSettle = function () {}),
            (e.prototype.getNavigateBoxBannerFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateBoxBanner = function () {}),
            (e.prototype.hideNavigateBoxBanner = function () {}),
            (e.prototype.getNavigateBoxPortalFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateBoxPortal = function () {}),
            (e.prototype.setGroup = function () {}),
            (e.prototype.hasAddDesktopFunc = function () {
                return !0;
            }),
            (e.prototype.getAddDesktopFlag = function (e) {
                qg.hasShortcutInstalled({
                    success: function (t) {
                        0 == t && e(!0);
                    },
                    fail: function (e) {
                        console.log("ChaoQiGameSDK", JSON.stringify(e));
                    },
                    complete: function () {}
                });
            }),
            (e.prototype.addDesktop = function (e) {
                qq.saveAppToDesktop({
                    success: function () {
                        console.log("ChaoQiGameSDK", "QQ 创建桌面图标成功"), e(!0);
                    },
                    fail: function (t) {
                        console.log("ChaoQiGameSDK", "QQ 创建桌面图标失败：", JSON.stringify(t)), e(!1);
                    },
                    complete: function () {}
                });
            }),
            (e.prototype.phoneVibrate = function (e) {
                "long" == e
                    ? qq.vibrateLong({
                          success: function () {},
                          fail: function (e) {
                              console.log("ChaoQiGameSDK", "QQ vibrateLong调用失败：", JSON.stringify(e));
                          }
                      })
                    : "short" == e &&
                      qq.vibrateShort({
                          success: function () {},
                          fail: function (e) {
                              console.log("ChaoQiGameSDK", "QQ vibrateShort调用失败：", JSON.stringify(e));
                          }
                      });
            }),
            (e.prototype.startGameVideo = function () {}),
            (e.prototype.pauseGameVideo = function () {}),
            (e.prototype.resumeGameVideo = function () {}),
            (e.prototype.stopGameVideo = function () {}),
            (e.prototype.shareVideo = function () {}),
            (e.prototype.jumpToMoreGamesCenter = function () {}),
            (e.prototype.showMoreGamesBanner = function () {}),
            (e.prototype.hideMoreGamesBanner = function () {}),
            (e.prototype.showFavoriteGuide = function () {}),
            (e.prototype.getBoxFlag = function () {
                return this.loadSucc_Box;
            }),
            (e.prototype.showAppBox = function () {
                this.loadSucc_Box &&
                    this.boxAd &&
                    (console.log("ChaoQiGameSDK", "QQ 展示盒子广告====================="), this.boxAd.show());
            }),
            (e.prototype.getBlockFlag = function () {
                return this.loadSucc_Block;
            }),
            (e.prototype.showBlock = function (e, t, o, n) {
                var a = this,
                    i = Number(qq.getSystemInfoSync().windowWidth),
                    r = Number(qq.getSystemInfoSync().windowHeight);
                (this.param_block = {
                    blockX: t * (i / cc.winSize.width),
                    blockY: (cc.winSize.height - o) * (r / cc.winSize.height),
                    blockType: e,
                    blockSize: n
                }),
                    "" != this.ID_Block && this.createBlock(),
                    setTimeout(function () {
                        console.log("ChaoQiGameSDK", "QQ showBlock====================="), a.blockAd.show();
                    }, 500),
                    (this.timeout_updateBlock = setTimeout(function () {
                        console.log("ChaoQiGameSDK", "QQ updateBlock====================="),
                            a.blockAd.destroy(),
                            a.showBlock(e, t, o, n);
                    }, 3e4));
            }),
            (e.prototype.hideBlock = function () {
                this.blockAd &&
                    (console.log("ChaoQiGameSDK", "QQ hideBlock====================="), this.blockAd.destroy()),
                    this.timeout_updateBlock && clearTimeout(this.timeout_updateBlock);
            }),
            (e.prototype.getVideoIntersFlag = function () {
                return !1;
            }),
            (e.prototype.showVideoInters = function () {}),
            (e.prototype.exitTheGame = function () {}),
            (e.prototype.reportAnalytics = function () {}),
            (e.prototype.showAuthentication = function (e) {
                e(!1);
            }),
            (e.prototype.visitorExperience = function (e) {
                e(!1);
            }),
            (e.prototype.showNativeAd = function () {}),
            (e.prototype.getOPPOShowMoreGameFlag = function () {
                return !1;
            }),
            (e.prototype.showOPPOMoreGame = function () {}),
            (e.prototype.hasNetwork = function (e) {
                e(!1);
            }),
            (e.prototype.showReviewAlert = function () {}),
            (e.prototype.showiOSADWithScene = function () {}),
            (e.prototype.showiOSADWithType = function () {}),
            (e.prototype.videoUIShow = function () {}),
            (e.prototype.showPrivacyAgreement = function (e, t, o) {
                o(!1);
            }),
            (e.prototype.getErrBannerFlag = function () {
                return !1;
            }),
            (e.prototype.showErrBanner = function (e) {
                e(!1);
            }),
            (e.prototype.hideErrBanner = function () {}),
            (e.prototype.getErrVideoFlag = function () {
                return !1;
            }),
            (e.prototype.buyProps = function (e, t, o, n) {
                n(!1, "");
            }),
            (e.prototype.payComplete = function () {}),
            (e.prototype.checkBannerLoadSucc = function () {
                var e = this;
                if (
                    ((this.loadSucc_Banner = this.SW_SystemBanner && this.loadSucc_SystemBanner),
                    console.log(
                        "ChaoQiGameSDK",
                        "banner加载成功?",
                        this.loadSucc_Banner,
                        ++this.NUM_CheckBannerLoadSucc
                    ),
                    this.timeout_checkBannerLoadSucc && clearTimeout(this.timeout_checkBannerLoadSucc),
                    this.loadSucc_Banner)
                )
                    this.showBanner();
                else {
                    if (this.NUM_CheckBannerLoadSucc >= this.NUM_MaxCheckBannerLoadSucc) return;
                    this.timeout_checkBannerLoadSucc = setTimeout(function () {
                        e.checkBannerLoadSucc();
                    }, 5e3);
                }
            }),
            (e.prototype.showSystemBanner = function () {
                this.bannerAd &&
                    (console.log("ChaoQiGameSDK", "QQ showSystemBanner========================"),
                    (this.hasShowBanner = !0),
                    this.bannerAd.show());
            }),
            (e.prototype.updateSystemBanner = function () {
                var e = this;
                this.interval_updateBanner && clearInterval(this.interval_updateBanner),
                    (this.interval_updateBanner = setInterval(function () {
                        console.log("ChaoQiGameSDK", "QQ updateSystemBanner========================"),
                            e.bannerAd.destroy(),
                            (e.bannerAd = null),
                            e.createSystemBanner();
                    }, 1e3 * this.NUM_BannerUpdateTime));
            }),
            (e.prototype.hideSystemBanner = function () {
                this.bannerAd &&
                    (console.log("ChaoQiGameSDK", "QQ hideSystemBanner========================"), this.bannerAd.hide()),
                    this.interval_updateBanner && clearInterval(this.interval_updateBanner);
            }),
            (e.prototype.showSystemInters = function () {
                this.systemIntersAd &&
                    this.loadSucc_SystemInters &&
                    (console.log("ChaoQiGameSDK", "QQ showSystemBanner========================"),
                    this.systemIntersAd.show());
            }),
            (e.prototype.runIntersInterval = function () {
                var e = this;
                this.NUM_IntersIntervalTime > 0 &&
                    setInterval(function () {
                        e.NUM_IntersNowIntervalTime++;
                    }, 1e3);
            }),
            e
        );
    })();
o.default = a;
